home *** CD-ROM | disk | FTP | other *** search
- *******************************************************************************
- * AmiExpress SV_Tools Copyright © 1994 2-Cool/EX4!
- * ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
- * $Release : 0.1 $
- * $Revision : 1.01 $
- * $Date : 12-Jan-94 $
- *
- * $Author(s) : Written by 2-Cool/EX4! (In MC680x0 Assembly under Asm-One)
- * $Note(s) : Position Independacy off a4 - (WARNING: DON`T TRASH A4!)
- * : Execbase Ptr is cached so that if running in fastmem access
- * : to execbase ptr is faster.
- *
- * $Purpose : CLI/Arexx tools for /X...
- *******************************************************************************
- AbsExecBase = 4 /* Execbase Definition */
- SUCCESS = 0 /* result return codes... */
- VAR_ERROR = 1 /* memory alloction failcode */
-
- SV_ICONIFY =181 ;iconify screen
- SV_UNICONIFY =153 ;uniconify screen
- SV_SYSOPLOGIN =154 ;sysop login
- SV_LOCAL =155 ;local login
- SV_INSTANT =170 ;remote login (instant)
- SV_ACCOUNTS =156 ;account editing
- SV_CHAT =157 ;
- SV_NODEOFFHOOK =158 ;offhook node
- SV_EXITNODE =159 ;offline node
- SV_INITMODEM =160 ;reset modem
- SV_SYSOPCHAT =161 ;sysop chat with user
- SV_RESERVE =171 ;reserve node for user
- SV_CHATTOGGLE =172
- SV_AESHELL =174
- SV_CLIPBOARD =175
- SV_START =176
- SV_NEWMSG =177
- SV_QUIETNODE =178
- SV_SETNRAMS =179
- SV_RESERVENODE =180 ;reserve node
-
- RESERVED_BLOCK10 =162
-
- CSI = $1b
- CLS macro
- dc.b CSI,'c',LF
- endm
-
- *-------------- Definition Includes...
-
- incdir _include:
- include exec/exec.i
- include "include:exec/funcdef.i"
- include intuition/intuition.i
- include graphics/videocontrol.i
- include libraries/asl.i
- include libraries/gadtools.i
- include libraries/dos_lib.i
- include libraries/intuition_lib.i
- include libraries/graphics_lib.i
- include libraries/exec_lib.i
- include libraries/asl_lib.i
- include libraries/icon_lib.i
- include libraries/diskfont_lib.i
- include libraries/gadtools_lib.i
- include libraries/wb_lib.i
- include libraries/rexxsyslib_lib.i
- include libraries/utility_lib.i
- include libraries/dosextens.i
- include utility/tagitem.i
- include dos/datetime.i
- include libraries/reqtools.i
-
- *-------------- Definition of Main Variables (Public) Block...
-
- STRUCTURE VarsBlock,0
-
- APTR _ExecBase /* ExecBase base */
- APTR _DOSBase /* DOS lib base */
- APTR _DOSOutput /* DOS output base */
- APTR _ArgPtr
- ULONG _ArgLen
-
- LABEL vars_SIZEOF
-
- *-------------- Definition of Macros...
-
- PUSH macro
- movem.l \1,-(sp)
- endm
- PULL macro
- movem.l (sp)+,\1
- endm
- PUSHW macro
- movem.w \1,-(sp)
- endm
- PULLW macro
- movem.w (sp)+,\1
- endm
- PUSHR macro
- move.l \1,-(sp)
- endm
- PULLR macro
- move.l (sp)+,\1
- endm
- CALL macro
- jsr _LVO\1(a6)
- endm
- CALLJ macro
- jmp _LVO\1(a6)
- endm
- CALLREL macro
- move.l \2(a4),a6
- CALL \1
- endm
-
- *******************************************************************************
- *-------------- Allocate our Variables (RS.) Area
-
- ProgStart: move.l a0,a5
- move.l d0,d5
-
- move.l #vars_SIZEOF,d0 ;length for our variables
- move.l #MEMF_PUBLIC+MEMF_CLEAR,d1 ;we want public mem, cleared
- move.l (AbsExecBase).w,a6 ;get SysBase
- CALL AllocMem ;allocate it...
- move.l d0,a4 ;ptr to our RS.Variables base
- bne.s RSValid ;did the alloc fail, if so exit
- moveq #VAR_ERROR,d0 ;Memory allocation fail code
- rts ;exit to dos...
-
- *-------------- From here a4 points to our variables area (DON`T DESTROY A4!)
-
- RSValid: move.l a6,(a4) ;cache execptr in Public so if
- ;we are in fastmem were faster
- move.l a5,_ArgPtr(a4)
- move.l d5,_ArgLen(a4)
- sf.b (a5,d5.w) ;null terminate arg string..
-
- *-------------- Open DOS Library
-
- moveq #0,d0 ;set lib version
- lea Dosname(pc),a1 ;lib name in a1
- CALL OpenLibrary ;try to open library
- move.l d0,_DOSBase(a4) ;store lib base
- beq.w ShutDown ;cleanup and quit if fail
-
- *-------------- Get DOS Output
-
- move.l d0,a6 ;get dosbase
- CALL Output ;get output base
- move.l d0,_DOSOutput(a4) ;save outputbase
-
- *-------------- Program starts here
-
- lea About.Txt(pc),a0 ;format string
- bsr.w OSPutStr
-
- move.l _ArgPtr(a4),a0
- cmp.b #"?",(a0)
- bne.s no_usage
-
- lea Args.Txt(pc),a0 ;format string
- bsr.w OSPutStr
- bra.w ShutDown
-
- no_usage move.l a5,a0
- lea ServerPortName(pc),a1
- *-------------- get 1st byte..
- moveq #10,d1
- move.b (a0)+,d0
- cmp.b #"0",d0
- beq.s its_a_zero
- blt.s bad_args
- cmp.b #"9",d0
- bgt.s bad_args
- move.b d0,9(a1) ;set node number (part a)
- bra.s not_a_zero
-
- its_a_zero: moveq #9,d1
-
- *-------------- get 2nd byte..
- not_a_zero: move.b (a0)+,d0
- beq.s its_okay
- cmp.b #$a,d0
- beq.s its_okay
- cmp.b #"0",d0
- blt.s bad_args
- cmp.b #"9",d0
- bgt.s bad_args
- move.b d0,(a1,d1.w)
-
- *-------------- get 3rd byte (should be zero or a LF)
-
- move.b (a0)+,d0
- beq.s its_okay
- cmp.b #$a,d0
- bne.s bad_args
- its_okay: move.l #SV_START,d7 ;command
- bsr CallNode ;send command to node...
- bra.s ShutDown
-
- bad_args: lea BadArgs.Txt(pc),a0 ;format string
- bsr.w OSPutStr
-
- *-------------- Program ends here
-
- *******************************************************************************
- * Shutdown() - Free all allocated resources & exit program
- * ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
- * Frees all previously allocated resources, sanity checks are made so only
- * allocated memory/open libraries will be removed.
- *******************************************************************************
- *-------------- Free DOS Library
-
- ShutDown: move.l _DOSBase(a4),d0 ;dos lib base in a1
- beq.s RSFreeMem
- move.l d0,a1
- CALL CloseLibrary ;close intuition
- clr.l _DOSBase(a4) ;clear out base
-
- *-------------- Free RS Variables Area
-
- RSFreeMem: move.l a4,a1 ;ptr to our RS.Variables base
- move.l #vars_SIZEOF,d0 ;no. of bytes to free
- move.l (a4),a6 ;get execbase
- CALL FreeMem ;free the memory
-
- moveq #SUCCESS,d0 ;no return code
- rts ;exit...
-
- *******************************************************************************
- * OSPutStr
- * ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
- * Sends a ascii text string to current console output
- *
- * $Inputs: a0.l = String ptr (null terminated)
- *******************************************************************************
-
- OSPutStr: move.l a0,d2
- moveq #-1,d3 ;d4=0
- .getlen2 addq.l #1,d3 ;increase string length by 1
- tst.b (a0)+ ;increase position
- bne.s .getlen2 ;nope not found, so keep on
-
- move.l _DOSOutput(a4),d1
- move.l _DOSBase(a4),a6
- jmp _LVOWrite(a6) ;print error msg to cli
-
- ******************************************************************************
- * String & Data Variable definitions
-
- Dosname: dc.b 'dos.library',0 ;dos lib name
- even
-
- CallNode: move.l (AbsExecBase).w,a6
- jsr _LVOFindPort(a6) ;find comms port
- move.l d0,d6
- bne.s is_active
-
- lea NotActive.Txt(pc),a0
- bra OSPutStr
-
- is_active: move.l #256,d0
- moveq #MEMF_PUBLIC,d1
- jsr _LVOAllocMem(a6) ;allocate structure
- move.l d0,a1
- bne.s DoCmd
- rts
-
- DoCmd: move.b #6,8(a1)
- move.w #256,18(a1) ;init structure
- clr.l 14(a1)
- move.l d7,224(a1) ;command
- moveq #1,d1
- move.l d1,220(a1) ;write()
- move.l d6,a0 ;portbase
- jmp _LVOPutMsg(a6)
-
- Version: dc.b '$VER: SV_STARTNODE v1.0 ',0
- even
- ServerPortName: dc.b 'AEServer.',0,0,0
- even
- About.Txt: CLS ; clear screen
- dc.b CSI,'[0m',CSI,'[1mSV_STARTNODE v1.0',CSI,'[0m ',CSI,'[33m(For use with /X BBS & Compatibles only!) ',CSI,'[0m',CSI,'[3mBy 2-Cool/EX4!',LF
- dc.b CSI,'[0mCopyright EX4 © 1993-94. All Rights Are Reserved.',LF
- dc.b 'Last Assembled: 15-Oct-94.',LF
- dc.b $a
- dc.b 0
- even
- BadArgs.Txt: dc.b 'Invalid Node number argument. Please specify an node in the range of 0-99!',$a
- dc.b 'Use "?" for usage.',$a,$a,0
- even
- NotActive.Txt: dc.b 'This Ami-Express node/port is not running!',$a,$a,$a
- even
- Args.Txt: dc.b 'Usage : ',CSI,'[32mSV_STARTNODE ',CSI,'[31m<node number>',LF
- dc.b 'Example : ',CSI,'[32mSV_STARTNODE ',CSI,'[31m0',LF,LF
-
- dc.b 'The node number range is from 0-99. This allows future compatibility ',$a
- dc.b 'if Ami-Express (or compatibles) ever support upto 99 nodes in this ',$a
- dc.b 'program format. The latest /X however only supports from 0-31. This',$a
- dc.b 'program is intended to be used from a CLI/Arexx script',$a,$a
- dc.b CSI,'[0m'
- dc.b 'This utility may not be supplied with any commercial package without',$a
- dc.b 'written consent from either IDS or EX4. It may NOT be placed on any ',$a
- dc.b 'CD-Rom media without signed & written notification from the authors ',$a
- dc.b 'allowing such activities. Full copyright is held by IDS and EX4.',$a,$a
- dc.b 0
-